<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <table border="1">
      <tr>
          <td>账号</td>
          <td><input type="text" name="username"></td>
      </tr>
      <tr>
          <td>密码</td>
          <td><input type="password" name="pwd"></td>
      </tr>
      <tr>
          <td><input type="submit" value="登陆" onclick="denlu()"></td>
      </tr>
  </table>
</body>
</html>
<script>
    function denlu()
    {
        var ajax=new XMLHttpRequest();
        ajax.onreadystatechange=function()
        {
            if(ajax.readyState==4&&ajax.status==200)
            {
                if(ajax.responseText==1)
                {
                    alert("登陆成功");
                }
                else
                {
                    alert("登陆失败");
                }
            }
        }
        ajax.open('get','user.php?username='+username,true);
        ajax.send();
    }
</script>